package group5.study.boitoan;

import group5.study.resources.Variables;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;



public class DefaultMenuActivity extends ListActivity {
	
	private ArrayAdapter<String> adapter;
	
		
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_default_menu);
		
		adapter = new ArrayAdapter<String>(DefaultMenuActivity.this,R.layout.category_item,R.id.content,Variables.titleDefaultMenu);
		setListAdapter(adapter);		
	}
	
	@Override
	protected void onListItemClick(ListView l,View v, int position, long id) 
	{
		Intent itListMain = new Intent("group5.study.boitoan.LISTMAIN");
		itListMain.putExtra(Variables.page1, position);
		startActivity(itListMain);
		Variables.title=position;
		/*if (position==1) _openListMainActivity();*/
		
	};
	
	/*private void _openListMainActivity(){
        để mở ListMainActivity, chúng ta cần 1 
        đối tượng Intent gắn với lớp ListMainActivity
        Intent itListMain = new Intent(getApplicationContext(), ListMainActivity.class);
         
        //dùng phương thức startActivity() để thực hiện mở
        startActivity(itListMain);
    }*/

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.default_menu, menu);
		return true;
	}

}
